﻿/*****************************************************************
*
*	Netcare Agent Project
*		Copyright(C) 2010, Wicresoft EKA. All Rights Reserved.
*
*	Authors:
*		Miles Chen (milesch@wicresoft.com)
*		TingRong Shi (trshi@wicresoft.com)
*
*	Part of the product code depends on gSOAP under GPL license
*		Copyright(C) 2000-2010, Robert van Engelen, Genivia Inc. All Rights Reserved.
*
*****************************************************************/
#include <iostream>


#include "netcare.h"
#include "soapHostSoap12Service.h"

#ifdef WIN32
#include "Service.h"
#endif

USING_STD;
USING_NETCARE_AGENT;

#ifndef MAX_CHAR
#define MAX_CHAR 1024
#endif

int main()
{
#ifdef WIN32
	CService svc;
	return svc.Run();
#else
	HostSoap12Service host;
	soap_set_mode(&host, SOAP_C_UTFSTRING);


	LogInfo(_T("Ready to run Netcare Agent Service on port 55555"));
	LogDebug(_T("尝试输出中文字！%s"), _T("中国"), 1, 2, 3.0F); //Valid
	LogDebug(_T("尝试输出中文字！%s"), "China", 1, 2, 3.0F); //Forbidden!!

	/* run iterative server on port until fatal error */
	if (host.run(55555))
	{ 
		char buffer[MAX_CHAR];
		host.soap_sprint_fault(buffer, MAX_CHAR);
		LogError(buffer);
		exit(-1);
	}

	return 0;
#endif
}